package com.ppc.ugo.service.impl;

import com.ppc.ugo.dao.mapper.FloorMapper;
import com.ppc.ugo.dao.pojo.Floor;
import com.ppc.ugo.service.FloorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional
@Service
@Slf4j
public class FloorServiceImpl implements FloorService {
    @Resource
    private FloorMapper floorMapper;

    @Override
    public void addFloor(Floor floor) {
        floorMapper.insert(floor);
        log.info("新增楼层：{}", floor.getName());
    }

    @Override
    public List<Floor> floorList() {
        List<Floor> floors = floorMapper.selectList(null);
        return floors;
    }
}
